﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Web.SystemConfig.SysCache
{
    public class ArchiveCacheFacade
    {
        private ArchiveCacheManager cacheManager = null;
        public void Init()
        {
            this.InitWorkFlowStatusCache();
            this.InitWorkFlowStatusRuleCache();
        }

        /// <summary>
        /// 缓存状态列表
        /// </summary>
        private void InitWorkFlowStatusCache()
        {
            cacheManager = ArchiveCacheManager.GetInstance();
            WorkFlow.WorkFlowMessageStatusCache statusCache = new WorkFlow.WorkFlowMessageStatusCache();
            statusCache.GetInstance();
            cacheManager.Add("statusCache", statusCache);
        }

        /// <summary>
        /// 缓存流程驱动列表
        /// </summary>
        private void InitWorkFlowStatusRuleCache()
        {
            WorkFlow.WorkFlowMessageStatusRuleListCache statusRuleCache = new WorkFlow.WorkFlowMessageStatusRuleListCache();
            statusRuleCache.GetInstance();
            cacheManager.Add("statusRuleCache", statusRuleCache);
        }

        public WorkFlow.WorkFlowMessageStatusCache GetStausCache()
        {
            ArchiveCacheManager cacheManager = ArchiveCacheManager.GetInstance();
            return cacheManager.Get("statusCache") as WorkFlow.WorkFlowMessageStatusCache;
        }

        public WorkFlow.WorkFlowMessageStatusRuleListCache GetStatusRuleCache()
        {
            ArchiveCacheManager cacheManager = ArchiveCacheManager.GetInstance();
            return cacheManager.Get("statusRuleCache") as WorkFlow.WorkFlowMessageStatusRuleListCache;
        }
    }
}
